/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.account.Key.AccountBy;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.cs.account.Account;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.soap.JaxbUtil;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import com.zimbra.soap.admin.message.GetMailboxRequest;
/*    */ import com.zimbra.soap.admin.message.GetMailboxResponse;
/*    */ import com.zimbra.soap.admin.type.MailboxByAccountIdSelector;
/*    */ import com.zimbra.soap.admin.type.MailboxWithMailboxId;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class GetMailbox
/*    */   extends AdminDocumentHandler
/*    */ {
/* 47 */   private static final String[] TARGET_ACCOUNT_PATH = { "mbox", "id" };
/*    */   
/* 49 */   protected String[] getProxiedAccountPath() { return TARGET_ACCOUNT_PATH; }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   public boolean domainAuthSufficient(Map context)
/*    */   {
/* 56 */     return true;
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   public boolean defendsAgainstDelegateAdminAccountHarvesting()
/*    */   {
/* 64 */     return true;
/*    */   }
/*    */   
/*    */   public Element handle(Element request, Map<String, Object> context) throws ServiceException
/*    */   {
/* 69 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/*    */     
/* 71 */     GetMailboxRequest req = (GetMailboxRequest)JaxbUtil.elementToJaxb(request);
/* 72 */     String accountId = req.getMbox().getId();
/*    */     
/* 74 */     Account account = Provisioning.getInstance().get(Key.AccountBy.id, accountId, zsc.getAuthToken());
/* 75 */     defendAgainstAccountHarvesting(account, Key.AccountBy.id, accountId, zsc, Rights.Admin.R_getMailboxInfo);
/*    */     
/* 77 */     Mailbox mbox = MailboxManager.getInstance().getMailboxByAccount(account);
/* 78 */     GetMailboxResponse resp = new GetMailboxResponse(new MailboxWithMailboxId(mbox.getId(), null, Long.valueOf(mbox.getSize())));
/*    */     
/* 80 */     return zsc.jaxbToElement(resp);
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 85 */     relatedRights.add(Rights.Admin.R_getMailboxInfo);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/GetMailbox.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */